#ifndef _DepthIntegrator_H_
#define _DepthIntegrator_H_

#pragma once
#include "Integrator.h"

class DepthIntegrator : public Integrator {
private:
	Color background;
	Double maxDepth;

public:
	DepthIntegrator(const Color &background, Double maxDepth) : background(background), maxDepth(maxDepth) {}
	~DepthIntegrator() {}

	Color Li(const Scene *scene, const Ray &ray, const TraceState & traceState) const {
		IntersectResult result;
		if (scene->intersect(result, ray)) {
			return Color(Float(CLAMP(1 - result.distance / maxDepth)));
		} else
			return background;
	}
};

#endif // _DepthIntegrator_H_